package utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;

public class CustomLogFormat extends Formatter {
	
	public String format(LogRecord record) {
		
		SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
		Calendar cal = Calendar.getInstance();
		StringBuffer res = new StringBuffer();
		
		cal.setTimeInMillis(record.getMillis());
		res.append(dateFormat.format(cal.getTime()));
		res.append(" {");
		res.append(record.getSourceClassName());
		res.append(" ");
		res.append(record.getSourceMethodName());
		res.append("} [");
		res.append(record.getLevel());
		res.append("] ");
		res.append(record.getMessage());
		res.append("\n");
		
		return res.toString();
	}
}